package com.yuwenxin.bean.enumPackage;

public enum Gender {
    UNKNOWN("未知"),MALE("男"),FEMALE("女");

    private final String value;

    Gender(String value) {
        this.value = value;
    }

    public String getValue(){
        return value;
    }

    @Override
    public String toString() {
        return this.getValue();
    }

    public static Gender parse(String value){
        for (Gender gender :
                Gender.values()) {
            if (gender.getValue().equals(value)){
                return gender;
            }
        }
        throw new IllegalArgumentException("不存在[" + value + "]对应的枚举值");
    }
}
